import urllib3
import re

#  忽略警告：InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised.
urllib3.disable_warnings()
# 一个PoolManager实例来生成请求, 由该实例对象处理与线程池的连接以及线程安全的所有细节
http = urllib3.PoolManager()
# 通过request()方法创建一个请求：
header = {
	'User-Agent': 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT6.1; Trident/5.0'
}
url = '''https://search.jd.com/Search?keyword=%E7%AC%94%E8%AE%B0%E6%9C%AC%E7%94%B5%E8%84%91&enc=utf-8&wq=%E7%AC%94%E8%AE%B0%E6%9C%AC%E7%94%B5%E8%84%91&pvid=27ecd40ea11a4896adcb6f53b7ca3a6d'''
httpResponse = http.request(
	'GET',
	url,
	fields={},
	headers=header
)
print(httpResponse.status)  # 200
# 获得html源码,utf-8解码
# print(httpResponse.data)
html= httpResponse.data.decode("utf8")

pattern = '<div class="gl-i-wrap">[\s\S]*?<div class="p-price">[\s\S]*?<em>￥</em><i>(\d+.?\d+)</i>[\s\S]*?</div>[\s\S]*?href="([\s\S]*?)"[\s\S]*?<em>([\s\S]*?)</em>[\s\S]*?</div>'

products = re.findall(pattern,html)
print(products)